#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <assert.h>
#include <stdlib.h>

//int main()
//{
//	int i = 0;
//	scanf("%d", &i);
//	printf("eeee");
//	return 0;
//}

typedef struct Y
{
	int* arr;
	int size;
	int capacity;
}Y;

void SLInit(Y* psl)
{
	assert(psl);
	psl->arr = (Y*)malloc(sizeof(int) * 4);
	if (psl->arr == 0)
	{
		perror("malloc fial");
		return;
	}
	psl->size = 0;
	psl->capacity = 4;
}

void SLInsert(Y* psl, int pos, int x)
{
	assert(psl);
	assert(pos >= 0 && pos <= psl->size);
	int end = psl->size;
	while (end > pos)
	{
		psl->arr[end] = psl->arr[end - 1];
		end--;
	}

	psl->arr[pos] = x;
	psl->size++;

}

void SLErase(Y* psl, int pos)
{
	assert(psl);
	assert(pos >= 0 && pos < psl->size);

	int start = pos + 1;
	while (start < psl->size)
	{
		psl->arr[start - 1] = psl->arr[start];
		start++;
	}
	psl->size--;
}


void SLPrint(Y* psl)
{
	assert(psl);
	int i = 0;
	for (i = 0; i < psl->size; i++)
	{
		printf("%d ", psl->arr[i]);
	}
	printf("\n");
}

int main()
{
	Y SL;
	SLInit(&SL);
	SLInsert(&SL, 0, 1);
	SLInsert(&SL, SL.size, 1);
	SLInsert(&SL, 1, 3);
	SLInsert(&SL, 1, 6);
	SLInsert(&SL, 3, 4);
	SLPrint(&SL);
	SLErase(&SL, 1);
	SLPrint(&SL);
	return 0;
}